Skip to main content

Unijob

Introduction

Script for creating jobs just by adding them to the config and database! Add your job now!

Get it now!​

Installation​

  1. Put ensure sqz_unijob to your server.cfg (or any start cfg file) and put the resource named sqz_unijob -maybe you will have to rename it- into your resources folder.
  2. Run the SQL file provided with the script
  3. Obviously configure your config, locales 😜

Creating a new job​

  1. Put the job to the jobs & job_grades to your database as usual
  2. Insert the society to the addon_account to your database in format: society_jobname
  3. Duplicate the whole table Config.Jobs.sandy_mechanic , change the sandy_mechanic to your job name and configure its properties
info

You do NOT NEED to put the job into the addon_inventory or datastore tables in your databases, sqz_unijob uses its own system.

Exports​

Get Player Handcuff state​

  • exports['sqz_unijob']:IsHandcuffed() - returns true/false
    • local isPlayerHandcuffed = exports['sqz_unijob']:IsHandcuffed()
  • LocalPlayer.state.handcuffed - again, returns true/false/nil
    • local isPlayerHandcuffed = LocalPlayer.state.handcuffed

Config Files​

SConfig = {}

SConfig.Webhooks = {
['sandy_mechanic'] = 'https://discord.com/api/webhooks/851478685764157520/-QeBCcYOHLRPO0gFAqd71SH_QEg-cQ2tNXHy8Enb6QdFF4aYe-COLaDGleooSbOEWzJJ', -- List of jobs that should use the webhook, remove it if you do not want to use the webhook for Discord
}

Common Issues​

  • If you get error when depositing money, make sure that the society is in the database in table addon_account
  • Getting error when taking items from the storage/buing items. It seems you are on version of es_extended that does not support xPlayer.canCarryItem and you must replace the event in the server/edit.lua to the one bellow
  • If you are getting error, make sure your es_extended version supports xPlayer.showNotification, otherwise you must replace again an event in the server/edit.lua
  • nil ESX it seems that you have changed events by anticheat so make sure to change them in your config files of the script
  • attempt to call a nil value (field 'showNotification') - Replace Notification event in the server/edit.lua to one provided bellow.
  • If search does not exist work, disable mythic probgress bar config option, because you do not use that script
RegisterNetEvent('sqz_unijob:Server:CanPlayerCarryItem')
AddEventHandler('sqz_unijob:Server:CanPlayerCarryItem', function(callback, playerId, itemName, count)
local xPlayer = ESX.GetPlayerFromId(playerId)
local xItem = xPlayer.getInventoryItem(itemName)

if xItem.limit == -1 or (xItem.count + tonumber(count)) <= xItem.limit then
callback(true)
else
TriggerEvent('sqz_unijob:Server:ShowNotification', playerId, _U('can_not_carry'))
callback(false)
end
end)